package com.wly
{
	import com.uibase.*;
	import com.uibase.card.Card;
	import com.uibase.card.CardGrid;
	import com.uibase.card.func.CommonCardClickControl;
	
	import flash.display.SimpleButton;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	import gs.TweenMax;
	
	public class CardTest extends Sprite
	{
		private var _card:Card;
		private var _cardgrid:CardGrid;
		private var _btnTest:SimpleButton;
		private var _btnTest1:SimpleButton;
		
		public function CardTest()
		{
			super();
			init();
			
			_btnTest = getChildByName("btnTest") as SimpleButton;
			
			if(_btnTest)
			{
				_btnTest.addEventListener(MouseEvent.CLICK, onTest);
			}
			
			_btnTest1 = getChildByName("btnTest1") as SimpleButton;
			
			if(_btnTest1)
			{
				_btnTest1.addEventListener(MouseEvent.CLICK, onTest1);
			}
			var _card:Card = new Card(1);
			addChild(_card);
			_card.x = 100;
			_card.cardClickControl = new CommonCardClickControl;
			_card.cardRotation = 30;
			
			_card = new Card(1);
			addChild(_card);
			_card.x = 200;
			_card.cardClickControl = new CommonCardClickControl;
			_card.cardRotation = 130;
			
			_card = new Card(1);
			addChild(_card);
			_card.x = 300;
			_card.cardClickControl = new CommonCardClickControl;
			_card.cardRotation = 210;
			
			_card = new Card(1);
			addChild(_card);
			_card.x = 400;
			_card.cardClickControl = new CommonCardClickControl;
			_card.cardRotation = 300;

//			
//			TweenMax.to(_card, 5, {cardRotation:360});
			
			_cardgrid  = new CardGrid();
			_cardgrid.x = 100;
			_cardgrid.y = 100;
			var cardArr:Array = [];
			cardArr.push(1,4,5,6);
			_cardgrid.updateCards(cardArr);
			addChild(_cardgrid);

			_cardgrid.cardClickControl = CommonCardClickControl;
		}
		
		private function onTest(e:MouseEvent):void
		{
			_cardgrid.cardRotation = 0;
			TweenMax.to(_cardgrid, 1, {cardRotation:180});
//			if(_cardgrid)
//			{
//				_cardgrid.addCard(53);
//			}
		}
		
		private function onTest1(e:MouseEvent):void
		{
			_cardgrid.cardRotation = 180;
			TweenMax.to(_cardgrid, 1, {cardRotation:360});
//			if(_cardgrid)
//			{
//				_cardgrid.delCardByVal(53);
//			}
		}
		
		private function init():void
		{
			Card1;
			Card2;
			Card3;
			Card4;
			Card5;
			Card6;
			Card7;
			Card8;
			Card9;
			Card10;
			Card11;
			Card12;
			Card13;
			Card14;
			Card15;
			Card16;
			Card17;
			Card18;
			Card19;
			Card20;
			Card21;
			Card22;
			Card23;
			Card24;
			Card25;
			Card26;
			Card27;
			Card28;
			Card29;
			Card30;
			Card31;
			Card32;
			Card33;
			Card34;
			Card35;
			Card36;
			Card37;
			Card38;
			Card39;
			Card40;
			Card41;
			Card42;
			Card43;
			Card44;
			Card45;
			Card46;
			Card47;
			Card48;
			Card49;
			Card50;
			Card51;
			Card52;
			Card53;
			Card54;
			Card55;
		}
	}
}